package com.shenmazong.serveruserapi.util;

/**
 * @author 田不平
 * @project server-xing-00
 * @date 2020/8/15 11:17 AM
 * http://www.shenmazong.com
 */
public class GoodNumber {
    public static boolean isGoodNum(Integer num) {
        String str = num + "";
        char[] nums = str.toCharArray();

        //-- 111 222
        if(nums[0] == nums[1] && nums[1] == nums[2]
                && nums[3] == nums[4] && nums[4] == nums[5]) {
            return true;
        }

        //-- 12 12 12
        Integer inum = num % 100;
        Integer inums = inum + inum*100 + inum*10000;
        if(inums.equals(num)) {
            return true;
        }

        //--567 567
        inum = num % 1000;
        inums = inum + inum*1000;
        if(inums.equals(num)) {
            return true;
        }

        return false;
    }

    public static void main(String[] args) {
        System.out.println("111111="+isGoodNum(111111));
        System.out.println("121212="+isGoodNum(121212));
        System.out.println("262626="+isGoodNum(262626));
        System.out.println("111222="+isGoodNum(111222));
        System.out.println("333777="+isGoodNum(333777));
        System.out.println("567567="+isGoodNum(567567));
    }
}
